<template>
    <table border="1px">
        <tr>
            <td colspan="2">申报项目信息</td>
        </tr>

        <tr>
            <td>项目编号</td>
            <td>{{pid}}</td>
        </tr>
        <tr>
            <td>项目名称</td>
            <td>{{pname}}</td>
        </tr>
        <tr>
            <td>申报开始日期</td>
            <td>{{startdate}}</td>
        </tr>
        <tr>
            <td>申报结束日期</td>
            <td>{{enddate}}</td>
        </tr>
        <tr>
            <td>申报状态</td>
            <td>
                <select v-model="sel">
                    <option value="1">审核中</option>
                    <option value="2">已审核</option>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="审核" @click="audit">
                <input type="button" value="返回" @click="back">
            </td>
        </tr>
    </table>
</template>

<script>

    import axios from "axios";
    import qs from "query-string"

    export default {
        name: "ProgramChange",
        data(){
            return{
                pid:this.$route.query.pid,
                pname:this.$route.query.pname,
                startdate:this.$route.query.startdate,
                enddate:this.$route.query.enddate,
                sel:1,
            }
        },
        methods:{
            audit(){
                let obj=this;
                axios.get("/api/program/change?"+qs.stringify({
                    pid:obj.pid,
                    status:obj.sel
                })).then(dt=>{
                    if(dt){
                        alert("审核成功")
                        this.$router.push({path:"/programshow?change=审核成功"});
                    }else{
                        alert("修改失败")
                    }
                })
            } ,
            back(){
               this.$router.push({path:"/programshow"})
            }
        }

    }
</script>

<style scoped>

</style>